﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;

namespace WCFMINERP.Patcher
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new FrmUpdate());
            //bool bCreatedNew;
            //Mutex m = new Mutex(false, "WCFMINERP", out bCreatedNew);

            //if (bCreatedNew)
            //{
            //    Application.Run(new FrmUpdate());
            //}
            //else
            //{
            //    MessageBox.Show("本程序已运行，请不要重复打开");
            //}
            bool isRunning = false;
            Process[] prc = Process.GetProcesses();
            foreach (Process p in prc)
            {
                if (p.ProcessName == "WCFMINERP.Update.exe")
                {
                    isRunning = true;
                    break;
                }
            }
            if (isRunning)
            {
                MessageBox.Show(" 已有客户端运行，不能重复打开");
            }
            else
            {
                Application.Run(new FrmUpdate());
            }


        }
    }
}
